count good nodes in binary tree